package com.soft.javase.day09.treeset;

import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/4/29
 */
public class NumberStringSort {
    public static void main(String[] args) {

        String str="8 10 15 5 2 7";
        String[] strings = str.split("\\s+");

        Set<Integer> set = new TreeSet<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1.compareTo(o2);
            }
        });

        for (String s : strings) {
            set.add(Integer.valueOf(s));
        }

        System.out.println(set);
    }
}
